<?php

/**
 * Alumno filter form base class.
 *
 * @package    reducars
 * @subpackage filter
 * @author     victor
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseAlumnoFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id_clase'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Clase'), 'add_empty' => true)),
      'id_comuna'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Comuna'), 'add_empty' => true)),
      'alum_nombre'      => new sfWidgetFormFilterInput(),
      'alum_apellidos'   => new sfWidgetFormFilterInput(),
      'alum_rut'         => new sfWidgetFormFilterInput(),
      'alum_correo'      => new sfWidgetFormFilterInput(),
      'alum_direccion'   => new sfWidgetFormFilterInput(),
      'alum_fono_fijo'   => new sfWidgetFormFilterInput(),
      'alum_fono_movil'  => new sfWidgetFormFilterInput(),
      'alum_user'        => new sfWidgetFormFilterInput(),
      'alum_pass'        => new sfWidgetFormFilterInput(),
      'alum_aprueba_teo' => new sfWidgetFormFilterInput(),
      'alum_fech_ingre'  => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'alum_ulti_ingre'  => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'alum_habilitado'  => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'id_clase'         => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Clase'), 'column' => 'id_clase')),
      'id_comuna'        => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Comuna'), 'column' => 'id_comuna')),
      'alum_nombre'      => new sfValidatorPass(array('required' => false)),
      'alum_apellidos'   => new sfValidatorPass(array('required' => false)),
      'alum_rut'         => new sfValidatorPass(array('required' => false)),
      'alum_correo'      => new sfValidatorPass(array('required' => false)),
      'alum_direccion'   => new sfValidatorPass(array('required' => false)),
      'alum_fono_fijo'   => new sfValidatorPass(array('required' => false)),
      'alum_fono_movil'  => new sfValidatorPass(array('required' => false)),
      'alum_user'        => new sfValidatorPass(array('required' => false)),
      'alum_pass'        => new sfValidatorPass(array('required' => false)),
      'alum_aprueba_teo' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'alum_fech_ingre'  => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'alum_ulti_ingre'  => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'alum_habilitado'  => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('alumno_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Alumno';
  }

  public function getFields()
  {
    return array(
      'id_alumno'        => 'Number',
      'id_clase'         => 'ForeignKey',
      'id_comuna'        => 'ForeignKey',
      'alum_nombre'      => 'Text',
      'alum_apellidos'   => 'Text',
      'alum_rut'         => 'Text',
      'alum_correo'      => 'Text',
      'alum_direccion'   => 'Text',
      'alum_fono_fijo'   => 'Text',
      'alum_fono_movil'  => 'Text',
      'alum_user'        => 'Text',
      'alum_pass'        => 'Text',
      'alum_aprueba_teo' => 'Number',
      'alum_fech_ingre'  => 'Date',
      'alum_ulti_ingre'  => 'Date',
      'alum_habilitado'  => 'Number',
    );
  }
}
